home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1994-11-20 | 2.5 KB | 114 lines |
- ' Example AMOS routines for using GRIME Maps
- '
- '
- '
- '
- '
- ' Load the map data (GRIME format) into an AMOS bank
- '
- A$="GRIME:Maps/newcheesey.grime"
- Open In 1,A$ : L=Lof(1) : Close 1
- Reserve As Work 10,L
- Bload A$,Start(10)
-
- '
- ' Load a block screen (IFF) into an AMOS screen
- '
- Load Iff "GRIME:IFFs/cheeseygrimegrafx.iff",0
- Screen Hide 0
-
- '
- ' Open an AMOS screen to draw our map onto
- '
- Screen Open 1,320,256,8,Lowres
- Curs Off : Paper 0 : Flash Off : Cls 0
- Get Palette 0
-
- '
- ' Make these variables global so that we can get the information from a
- ' GRIME map using the _GETGRIMEINFO routine
- '
- Global BLOCKX,BLOCKY,MAPX,MAPY,BASE_BLOCK
- Global HEADEROFFSET,POSY,POSX
- HEADEROFFSET=20
-
- '
- ' Grab the information from the GRIME header and display it for the user
- '
- _GETGRIMEINFO[10]
- Print "Information for current Map..."
- Print : Print "Blocks are ";BLOCKX;" x ";BLOCKY
- Print "Map is ";MAPX;" x ";MAPY
- Print "Base Block is ";BASE_BLOCK
- Print : Print "Press a key to view map"
- Wait Key
-
- '
- ' Display the map on the screen using different offsets within the map
- '
- POSX=0 : POSY=0 : DISPLAYMAP
- Wait 20
- POSX=10 : POSY=0 : DISPLAYMAP
- Wait 20
- POSX=0 : POSY=12 : DISPLAYMAP
- Wait 20
- POSX=10 : POSY=12 : DISPLAYMAP
-
-
- '
- ' Procedures.....
- '
-
- Procedure DISPLAYMAP
-
- '
- ' Make sure we are in the correct drawing mode and grab the screen width
- ' of the block screen (Needed for calculations in the main loop
- '
- Gr Writing 0 : Ink 0
- SCRW=Screen Width(0)
-
- '
- ' Our Loop for displaying the map
- '
- For Y=0 To 7
- For X=0 To 9
- '
- ' Get the block number for this map position
- '
- ' Map Base Header Y Position X Position
- BLOCK=Deek(Start(10)+HEADEROFFSET+((((POSY+Y)*MAPX)+(POSX+X))*2))
-
- '
- ' Calculate the position of this block on our block screen
- '
- GRPHX=BLOCK*BLOCKX : GRPHY=0
- While GRPHX+BLOCKX>SCRW
- Add GRPHY,BLOCKY
- Add GRPHX,-SCRW
- Wend
-
- '
- ' Now copy from the block screen onto our map screen
- '
- Screen Copy 0,GRPHX,GRPHY,GRPHX+BLOCKX,GRPHY+BLOCKY To 1,X*BLOCKX,Y*BLOCKY
-
- '
- ' This provides a number overlay (Just like GRIME :)
- '
- Text X*BLOCKX,Y*BLOCKY+8,Str$(BLOCK)
-
- Next X
- Next Y
- End Proc
-
- Procedure _GETGRIMEINFO[MAP]
- '
- ' Grab some information from the GRIME header
- '
- BLOCKX=Deek(Start(MAP)+6)
- BLOCKY=Deek(Start(MAP)+8)
- MAPX=Deek(Start(MAP)+10)
- MAPY=Deek(Start(MAP)+12)
- BASE_BLOCK=Deek(Start(MAP)+14)
- End Proc